{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "efcd6f14",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "# note that all ndarrays must be the same length!\n",
    "input_arrays = {\n",
    "    'open': np.random.random(100),\n",
    "    'high': np.random.random(100),\n",
    "    'low': np.random.random(100),\n",
    "    'close': np.random.random(100),\n",
    "    'volume': np.random.random(100)\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f3261d48",
   "metadata": {},
   "outputs": [],
   "source": [
    "from talib import abstract\n",
    "sma = abstract.SMA\n",
    "sma = abstract.Function('sma')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1e8734a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from talib.abstract import *\n",
    "output = SMA(input_arrays, timeperiod=25) # calculate on close prices by default\n",
    "output = SMA(input_arrays, timeperiod=25, price='open') # calculate on opens\n",
    "upper, middle, lower = BBANDS(input_arrays, 20, 2, 2)\n",
    "slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0) # uses high, low, close by default\n",
    "slowk, slowd = STOCH(input_arrays, 5, 3, 0, 3, 0, prices=['high', 'low', 'open'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c938e625",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Cycle Indicators': ['HT_DCPERIOD',\n",
       "  'HT_DCPHASE',\n",
       "  'HT_PHASOR',\n",
       "  'HT_SINE',\n",
       "  'HT_TRENDMODE'],\n",
       " 'Math Operators': ['ADD',\n",
       "  'DIV',\n",
       "  'MAX',\n",
       "  'MAXINDEX',\n",
       "  'MIN',\n",
       "  'MININDEX',\n",
       "  'MINMAX',\n",
       "  'MINMAXINDEX',\n",
       "  'MULT',\n",
       "  'SUB',\n",
       "  'SUM'],\n",
       " 'Math Transform': ['ACOS',\n",
       "  'ASIN',\n",
       "  'ATAN',\n",
       "  'CEIL',\n",
       "  'COS',\n",
       "  'COSH',\n",
       "  'EXP',\n",
       "  'FLOOR',\n",
       "  'LN',\n",
       "  'LOG10',\n",
       "  'SIN',\n",
       "  'SINH',\n",
       "  'SQRT',\n",
       "  'TAN',\n",
       "  'TANH'],\n",
       " 'Momentum Indicators': ['ADX',\n",
       "  'ADXR',\n",
       "  'APO',\n",
       "  'AROON',\n",
       "  'AROONOSC',\n",
       "  'BOP',\n",
       "  'CCI',\n",
       "  'CMO',\n",
       "  'DX',\n",
       "  'MACD',\n",
       "  'MACDEXT',\n",
       "  'MACDFIX',\n",
       "  'MFI',\n",
       "  'MINUS_DI',\n",
       "  'MINUS_DM',\n",
       "  'MOM',\n",
       "  'PLUS_DI',\n",
       "  'PLUS_DM',\n",
       "  'PPO',\n",
       "  'ROC',\n",
       "  'ROCP',\n",
       "  'ROCR',\n",
       "  'ROCR100',\n",
       "  'RSI',\n",
       "  'STOCH',\n",
       "  'STOCHF',\n",
       "  'STOCHRSI',\n",
       "  'TRIX',\n",
       "  'ULTOSC',\n",
       "  'WILLR'],\n",
       " 'Overlap Studies': ['BBANDS',\n",
       "  'DEMA',\n",
       "  'EMA',\n",
       "  'HT_TRENDLINE',\n",
       "  'KAMA',\n",
       "  'MA',\n",
       "  'MAMA',\n",
       "  'MAVP',\n",
       "  'MIDPOINT',\n",
       "  'MIDPRICE',\n",
       "  'SAR',\n",
       "  'SAREXT',\n",
       "  'SMA',\n",
       "  'T3',\n",
       "  'TEMA',\n",
       "  'TRIMA',\n",
       "  'WMA'],\n",
       " 'Pattern Recognition': ['CDL2CROWS',\n",
       "  'CDL3BLACKCROWS',\n",
       "  'CDL3INSIDE',\n",
       "  'CDL3LINESTRIKE',\n",
       "  'CDL3OUTSIDE',\n",
       "  'CDL3STARSINSOUTH',\n",
       "  'CDL3WHITESOLDIERS',\n",
       "  'CDLABANDONEDBABY',\n",
       "  'CDLADVANCEBLOCK',\n",
       "  'CDLBELTHOLD',\n",
       "  'CDLBREAKAWAY',\n",
       "  'CDLCLOSINGMARUBOZU',\n",
       "  'CDLCONCEALBABYSWALL',\n",
       "  'CDLCOUNTERATTACK',\n",
       "  'CDLDARKCLOUDCOVER',\n",
       "  'CDLDOJI',\n",
       "  'CDLDOJISTAR',\n",
       "  'CDLDRAGONFLYDOJI',\n",
       "  'CDLENGULFING',\n",
       "  'CDLEVENINGDOJISTAR',\n",
       "  'CDLEVENINGSTAR',\n",
       "  'CDLGAPSIDESIDEWHITE',\n",
       "  'CDLGRAVESTONEDOJI',\n",
       "  'CDLHAMMER',\n",
       "  'CDLHANGINGMAN',\n",
       "  'CDLHARAMI',\n",
       "  'CDLHARAMICROSS',\n",
       "  'CDLHIGHWAVE',\n",
       "  'CDLHIKKAKE',\n",
       "  'CDLHIKKAKEMOD',\n",
       "  'CDLHOMINGPIGEON',\n",
       "  'CDLIDENTICAL3CROWS',\n",
       "  'CDLINNECK',\n",
       "  'CDLINVERTEDHAMMER',\n",
       "  'CDLKICKING',\n",
       "  'CDLKICKINGBYLENGTH',\n",
       "  'CDLLADDERBOTTOM',\n",
       "  'CDLLONGLEGGEDDOJI',\n",
       "  'CDLLONGLINE',\n",
       "  'CDLMARUBOZU',\n",
       "  'CDLMATCHINGLOW',\n",
       "  'CDLMATHOLD',\n",
       "  'CDLMORNINGDOJISTAR',\n",
       "  'CDLMORNINGSTAR',\n",
       "  'CDLONNECK',\n",
       "  'CDLPIERCING',\n",
       "  'CDLRICKSHAWMAN',\n",
       "  'CDLRISEFALL3METHODS',\n",
       "  'CDLSEPARATINGLINES',\n",
       "  'CDLSHOOTINGSTAR',\n",
       "  'CDLSHORTLINE',\n",
       "  'CDLSPINNINGTOP',\n",
       "  'CDLSTALLEDPATTERN',\n",
       "  'CDLSTICKSANDWICH',\n",
       "  'CDLTAKURI',\n",
       "  'CDLTASUKIGAP',\n",
       "  'CDLTHRUSTING',\n",
       "  'CDLTRISTAR',\n",
       "  'CDLUNIQUE3RIVER',\n",
       "  'CDLUPSIDEGAP2CROWS',\n",
       "  'CDLXSIDEGAP3METHODS'],\n",
       " 'Price Transform': ['AVGPRICE', 'MEDPRICE', 'TYPPRICE', 'WCLPRICE'],\n",
       " 'Statistic Functions': ['BETA',\n",
       "  'CORREL',\n",
       "  'LINEARREG',\n",
       "  'LINEARREG_ANGLE',\n",
       "  'LINEARREG_INTERCEPT',\n",
       "  'LINEARREG_SLOPE',\n",
       "  'STDDEV',\n",
       "  'TSF',\n",
       "  'VAR'],\n",
       " 'Volatility Indicators': ['ATR', 'NATR', 'TRANGE'],\n",
       " 'Volume Indicators': ['AD', 'ADOSC', 'OBV']}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import talib\n",
    "talib.get_functions()\n",
    "talib.get_function_groups()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "5b7ebe52",
   "metadata": {},
   "outputs": [],
   "source": [
    "real = EMA(input_arrays, timeperiod=30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "566f5f32",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([       nan,        nan,        nan,        nan,        nan,\n",
       "              nan,        nan,        nan,        nan,        nan,\n",
       "              nan,        nan,        nan,        nan,        nan,\n",
       "              nan,        nan,        nan,        nan,        nan,\n",
       "              nan,        nan,        nan,        nan,        nan,\n",
       "              nan,        nan,        nan,        nan, 0.44791388,\n",
       "       0.45870011, 0.47005946, 0.50321643, 0.5159493 , 0.53762311,\n",
       "       0.53811641, 0.51044056, 0.51167371, 0.4947256 , 0.4871719 ,\n",
       "       0.50509109, 0.48642288, 0.47729043, 0.4669654 , 0.45087044,\n",
       "       0.42880465, 0.40778556, 0.38537624, 0.416129  , 0.40572618,\n",
       "       0.42712448, 0.40664167, 0.40262396, 0.38820013, 0.36581808,\n",
       "       0.36142388, 0.36698494, 0.35092714, 0.37914633, 0.38624488,\n",
       "       0.37286062, 0.36326473, 0.37991201, 0.3655115 , 0.38253227,\n",
       "       0.40017185, 0.43044059, 0.44454158, 0.46608527, 0.48154464,\n",
       "       0.45717547, 0.47111374, 0.50087341, 0.52121923, 0.53586997,\n",
       "       0.50610367, 0.53275343, 0.51278501, 0.48778426, 0.51807321,\n",
       "       0.48771669, 0.51425629, 0.49308312, 0.51386581, 0.49333622,\n",
       "       0.46258103, 0.48369928, 0.47578835, 0.50897097, 0.50426974,\n",
       "       0.53571867, 0.501519  , 0.5179731 , 0.52880387, 0.53812214,\n",
       "       0.53539477, 0.53967517, 0.54039409, 0.52276315, 0.50620542])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "76dc0be2",
   "metadata": {},
   "outputs": [],
   "source": [
    "real = ACOS(input_arrays)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0a5406dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.66080402, 1.56884583, 0.71144231, 0.42402511, 0.8068572 ,\n",
       "       1.50863136, 0.34757786, 0.43037877, 0.76985885, 1.33063754,\n",
       "       1.36474788, 1.47733633, 0.95408051, 1.52491547, 1.20861899,\n",
       "       1.50220024, 0.42658002, 1.11111632, 1.57048123, 0.90953033,\n",
       "       1.31057892, 1.44461021, 0.86061106, 0.90651915, 1.18900195,\n",
       "       1.39653062, 0.72798482, 1.32185295, 1.48139504, 0.60040922,\n",
       "       0.90828299, 0.88308543, 0.17916688, 0.79459194, 0.55120662,\n",
       "       0.99408589, 1.4614378 , 1.0127212 , 1.31917145, 1.18354646,\n",
       "       0.69988038, 1.35335301, 1.21869606, 1.24796558, 1.35155043,\n",
       "       1.46172954, 1.46760451, 1.51031833, 0.53150763, 1.31306731,\n",
       "       0.74158342, 1.46093452, 1.21923177, 1.39077083, 1.52950629,\n",
       "       1.26850544, 1.10669391, 1.45243109, 0.66271536, 1.0596539 ,\n",
       "       1.39104111, 1.34475195, 0.90039862, 1.41344372, 0.89010107,\n",
       "       0.85536145, 0.51693656, 0.86451912, 0.67857382, 0.78737796,\n",
       "       1.4667864 , 0.83224327, 0.36983031, 0.61593518, 0.72529207,\n",
       "       1.49623487, 0.40481586, 1.34565631, 1.44519297, 0.29341061,\n",
       "       1.52323118, 0.45313169, 1.38363344, 0.61769624, 1.37386882,\n",
       "       1.55416478, 0.66012766, 1.20137072, 0.14069423, 1.11953387,\n",
       "       0.12871191, 1.56517247, 0.71276369, 0.81502507, 0.8322184 ,\n",
       "       1.05198536, 0.92511725, 0.98745193, 1.30039874, 1.30143244])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "d7366299",
   "metadata": {},
   "outputs": [],
   "source": [
    "real = ADXR(input_arrays, timeperiod=14)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "22df10f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([        nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "       15.01481345, 15.19154943, 14.16742708, 13.21645633, 12.978689  ,\n",
       "       12.99805462, 13.01188593, 13.6247148 , 13.40248698, 13.19613258,\n",
       "       13.65270985, 14.09971105, 14.51478359, 15.73012328, 16.64151319,\n",
       "       16.74745849, 16.51861508, 17.16749158, 17.64097537, 17.57273107,\n",
       "       18.10934688, 18.34764601, 18.84942229, 19.62117697, 20.82502912,\n",
       "       21.15184886, 21.79169081, 22.67591812, 23.49698634, 24.18245056,\n",
       "       25.23119471, 25.85730006, 26.04649979, 25.29810485, 25.06187295,\n",
       "       25.12301327, 25.30415739, 26.21859405, 25.63132234, 25.57700366,\n",
       "       26.03379305, 26.5857179 , 27.34848448, 27.81787009, 27.31326936,\n",
       "       27.12106316, 25.64801039, 24.64459324, 23.84538111, 23.02750851,\n",
       "       22.79356063, 21.93097482, 21.67662315, 21.27635681, 21.0324442 ,\n",
       "       21.26381886, 21.24769919, 20.27247739, 19.6306899 , 18.50741346])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "7632d07b",
   "metadata": {},
   "outputs": [],
   "source": [
    "real = CCI(input_arrays, timeperiod=14)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "cfaf49f4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([          nan,           nan,           nan,           nan,\n",
       "                 nan,           nan,           nan,           nan,\n",
       "                 nan,           nan,           nan,           nan,\n",
       "                 nan,  -20.88509498,   -3.52789017,  -53.23635156,\n",
       "        171.69690486,   50.81423204,   19.04406208,  -59.87279203,\n",
       "         -5.36521715,  -24.5390485 ,   -2.40507672,  -15.85216512,\n",
       "        -19.96798389,  -99.67284553,   58.01819194, -120.95479119,\n",
       "         26.37180436,   59.7624443 , -108.16154773,   48.98455342,\n",
       "        269.85335652,   57.95484885,   66.78216385, -109.53224126,\n",
       "        -79.88372108,  -64.83485908,   -8.7178667 ,   -4.86401667,\n",
       "        186.93041884,   17.64198013, -107.12938359,  -70.73402778,\n",
       "         -8.51401896, -125.05730033, -109.92448541,   34.62192257,\n",
       "         66.96324108, -101.96363003,  121.29116928,   29.819744  ,\n",
       "         30.39277656,   59.23249337,  -38.62346342,  -14.50827372,\n",
       "        -13.49881681,  -18.54806519,   50.31648562,  -63.91476628,\n",
       "       -129.38112976,   -5.7145176 ,   72.40843033, -102.49654344,\n",
       "        132.81752624,  -24.08910789,  -27.35828514,  116.75981411,\n",
       "        -17.05572142,   61.34011597,   76.38182368,   99.39808235,\n",
       "        183.19634265,   -7.66024596,   75.84344089, -148.96147495,\n",
       "         -2.40416276,   82.46050591, -166.03156938,   73.97689677,\n",
       "       -124.15844979,   24.99803954,   -0.52721725,   62.64278664,\n",
       "        -74.87843949,   -9.61700265,    3.19536229,  -12.77354983,\n",
       "         92.89327596,  -44.27946915,  101.2925429 ,  -17.29977698,\n",
       "         89.26531083,   32.11292877,   26.8833484 ,   97.31170828,\n",
       "        116.83691949,   30.99888794, -183.91801811,  -53.00717941])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "real"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "7ad7d29b",
   "metadata": {},
   "outputs": [],
   "source": [
    "real = MFI(input_arrays, timeperiod=14)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "bd677ff3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([        nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan,         nan,\n",
       "               nan,         nan,         nan,         nan, 59.85987932,\n",
       "       59.9849425 , 60.80855539, 55.08668606, 49.44464098, 51.98086444,\n",
       "       53.00248637, 50.95128684, 48.87192289, 50.2518839 , 43.13046141,\n",
       "       39.04388972, 53.03219641, 47.04244392, 54.95524491, 61.77703374,\n",
       "       56.62138039, 68.75716674, 77.43478172, 77.21451389, 75.27043426,\n",
       "       75.76977815, 74.31097835, 75.62982688, 79.41170955, 83.29458828,\n",
       "       84.31431671, 84.83434033, 80.42043994, 79.82338902, 85.09259425,\n",
       "       79.32538352, 78.13687086, 83.73387472, 85.24072936, 84.70698768,\n",
       "       85.18317599, 75.45345526, 74.70160048, 76.59064332, 64.0612201 ,\n",
       "       69.17692193, 73.38603549, 68.27217629, 68.61608878, 65.79251394,\n",
       "       63.98557347, 64.37507756, 63.19900837, 62.36442857, 61.35022451,\n",
       "       67.51485826, 61.70620065, 54.67847121, 54.80735076, 56.5723416 ,\n",
       "       53.4591033 , 64.40512076, 67.15902737, 68.17419137, 69.85857605,\n",
       "       65.83103784, 63.74951058, 73.05892968, 70.32114862, 72.25708848,\n",
       "       75.45585296, 75.23901461, 81.39359222, 82.60000799, 79.568029  ,\n",
       "       77.49597   , 73.33719368, 68.19979717, 68.62416694, 59.53253088,\n",
       "       58.41446952, 49.32210948, 55.1793231 , 44.46498662, 45.73841611,\n",
       "       52.2967878 , 63.84022331, 51.02556838, 50.5353164 , 50.51843527])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "real\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d20742b8",
   "metadata": {},
   "outputs": [
    {
     "ename": "IndentationError",
     "evalue": "unexpected indent (Temp/ipykernel_11312/1581152564.py, line 64)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"C:\\Users\\zhang\\AppData\\Local\\Temp/ipykernel_11312/1581152564.py\"\u001b[1;36m, line \u001b[1;32m64\u001b[0m\n\u001b[1;33m    output = tl.DX(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n"
     ]
    }
   ],
   "source": [
    " #17、ADX 平均趋向指数 adx = tl.ADX(high, low, close, timeperiod=14)\n",
    "    # output = tl.ADX(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)\n",
    "    # plt.plot(high_price_arr)\n",
    "    # plt.plot(low_price_arr)\n",
    "    # plt.plot(close_price_arr)\n",
    "    # plt.plot(output)\n",
    "    # plt.legend(['high', 'low', 'close', 'output'])\n",
    "    # plt.show()\n",
    "    \n",
    "    \n",
    "    #18、ADXR 平均趋向指数 adx = tl.ADXR(high, low, close, timeperiod=14)\n",
    "    # output = tl.ADXR(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)\n",
    "    # plt.plot(high_price_arr)\n",
    "    # plt.plot(low_price_arr)\n",
    "    # plt.plot(close_price_arr)\n",
    "    # plt.plot(output)\n",
    "    # plt.legend(['high', 'low', 'close', 'output'])\n",
    "    # plt.show()\n",
    "    \n",
    "    #19、APO 绝对价格震荡指标\n",
    "    #价格振荡器指数表示两个移动平均值的差，类似MACD，只是APO在时间周期上更灵活。\n",
    "    #当APO上穿0，表示买入信号；\n",
    "    #当APO下穿0，表示卖出信号。\n",
    "    # output = tl.APO(close_price_arr, fastperiod=12, slowperiod=26, matype=0)\n",
    "    # plt.plot([0]*len(output))\n",
    "  \n",
    "    \n",
    "    #20、AROON 阿隆指标 阿隆上线（AroonUp）和阿隆下线（AroonDown）反映的是当前时间与之前最高价或最低价的远近\n",
    "    #当 AroonUp大于AroonDown，并且AroonUp大于50，多头开仓；\n",
    "    #当 AroonUp小于AroonDown，或者AroonUp小于50，多头平仓；\n",
    "    #当 AroonDown大于AroonUp，并且AroonDown大于50，空头开仓；\n",
    "    #当 AroonDown小于AroonUp，或者AroonDown小于50，空头平仓。  \n",
    "    # aroondown, aroonup = tl.AROON(high_price_arr, low_price_arr, timeperiod=14)\n",
    "    # plt.plot(close_price_arr)\n",
    "    # plt.plot(aroondown)\n",
    "    # plt.plot(aroonup)\n",
    "    # plt.legend(['close', 'aroondown', 'aroonup'])\n",
    "    # plt.show()\n",
    "    \n",
    "    \n",
    "    #21、AROONOSC 阿隆振荡\n",
    "    # output = tl.AROONOSC(high_price_arr, low_price_arr, timeperiod=14)\n",
    "#    plt.plot(close)\n",
    "#    plt.plot(dema)\n",
    "#    plt.show()\n",
    "#    plt.plot(arronosc)\n",
    "#    plt.legend(['close', 'dema', 'arronosc'])\n",
    "#    plt.show()\n",
    " \n",
    "    #22、BOP 均势指标\n",
    "    #显示了当前趋势的强度和方向\n",
    "    # output = tl.BOP(open_price_arr, high_price_arr, low_price_arr, close_price_arr)\n",
    "    # plt.plot([0]*len(output))\n",
    "    \n",
    "    #23、CCI 顺势指标 https://www.jianshu.com/p/ad9c80c7bf0a\n",
    "    #是否已超出常态分布范围。属于超买超卖类指标中较特殊的一种\n",
    "    # output = tl.CCI(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)\n",
    " \n",
    "    #24、CMO 钱德动量摆动指标 上涨日相对于下跌日的天数比例\n",
    "    #当本指标下穿-50水平时是买入信号，上穿+50水平是卖出信号\n",
    "    # output = tl.CMO(close_price_arr, timeperiod=14)\n",
    "    \n",
    "    #26、DX DMI指标又叫动向指标或趋向指标\n",
    "    output = tl.DX(high_price_arr, low_price_arr, close_price_arr, timeperiod=14)\n",
    "    \n",
    "    plt.plot(close_price_arr)\n",
    "    plt.plot(output)\n",
    "    \n",
    "    plt.legend(['close', 'output'])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "78d8f6ac",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
